import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from 'path'
import { fileURLToPath } from 'url'

const __dirname = fileURLToPath(new URL('.', import.meta.url))
const pathResolve = (dir: string) => resolve(__dirname, dir)

export default defineConfig({
  plugins: [vue()],
  css: {
    preprocessorOptions: {
      scss: {
        // 移除全局注入以避免循环引用
      },
    },
  },
  server: {
    port: 3007,
    open: true,
    cors: true,
  },
  resolve: {
    // 修改别名配置为数组格式，增强兼容性
    alias: [
      { find: '@', replacement: pathResolve('./src/') }
    ]
  }
})